package com.yn.common.request.zy;


import com.yn.common.model.zy.OrganDepartment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;


@Data
@ApiModel("医院科室新增对象")
public class OrganDepartmentRequest {

    @ApiModelProperty(value = "科室ID",  example = "1")
    private Integer id;

    @ApiModelProperty(value = "科室名称", required = true, example = "科室名称")
    @NotBlank(message = "科室名称不能为空")
    private String departmentName;

    @ApiModelProperty(value = "父级id", example = "0")
    @NotNull(message = "父级id不能为空")
    private Integer parentId;

    public static OrganDepartment transform(OrganDepartmentRequest request){
        if(request == null){
            return null;
        }
        OrganDepartment organDepartment = new OrganDepartment();
        organDepartment.setDepartmentName(request.getDepartmentName());
        organDepartment.setParentId(request.getParentId());
        return organDepartment;
    }
}
